package com.erp.erp_servers.business.imp;

import com.erp.erp_dao.business.ICarryDetailProductDao;
import com.erp.erp_entitys.business.entity.CarryDetailProductEntity;
import com.erp.erp_entitys.business.req.ImportPlanRemainingQuantityReq;
import com.erp.erp_entitys.warehouse.rsp.CarryDetailInfoRsp;
import com.erp.erp_entitys.warehouse.rsp.ImportCarryProductOfOutStockRsp;
import com.erp.erp_servers.business.ICarryDetailProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : CarryDetailProductServiceImp
 * @Description : 出运明细产品实现层
 * @Author : lst
 * @Date: 2021-01-07 20:46
 */
@Service
public class CarryDetailProductServiceImp implements ICarryDetailProductService {

    /**
     * 注入出运明细产品mapper
     */
    private final ICarryDetailProductDao carryDetailProductDao;

    @Autowired
    public CarryDetailProductServiceImp(ICarryDetailProductDao carryDetailProductDao) {
        this.carryDetailProductDao = carryDetailProductDao;
    }


    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CarryDetailProductEntity queryById(Integer id) {
        return carryDetailProductDao.queryById(id);
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param carryDetailProduct 实例对象
     * @return 对象列表
     */
    @Override
    public List<CarryDetailProductEntity> queryAll(CarryDetailProductEntity carryDetailProduct) {
        return carryDetailProductDao.queryAll(carryDetailProduct);
    }


    /**
     * 新增数据
     *
     * @param carryDetailProduct 实例对象
     * @return 影响行数
     */
    @Override
    public int insert(CarryDetailProductEntity carryDetailProduct) {
        return carryDetailProductDao.insert(carryDetailProduct);
    }


    /**
     * 修改数据
     *
     * @param carryDetailProduct 实例对象
     * @return 影响行数
     */
    @Override
    public int update(CarryDetailProductEntity carryDetailProduct) {
        return carryDetailProductDao.update(carryDetailProduct);
    }


    /**
     * 通过id获取出运明细产品对象
     * @param id 出运明细产品id
     * @return 出运明细产品对象
     */
    @Override
    public CarryDetailProductEntity getCarryDetailProductById(Integer id) {
        return carryDetailProductDao.getCarryDetailProductById(id);
    }


    /**
     * 通过出运明细id获取出运明细产品信息
     * @param id 出运明细id
     * @return 出运明细产品信息
     */
    @Override
    public List<CarryDetailInfoRsp> getCarryDetailProductList(Integer id) {
        return carryDetailProductDao.getCarryDetailProductList(id);
    }


    /**
     * 获取已调用的出运明细产品信息
     * @param req 查询参数对象
     * @return 已调用的出运明细产品信息
     */
    @Override
    public List<CarryDetailProductEntity> getUsedProductInfo(ImportPlanRemainingQuantityReq req) {
        return carryDetailProductDao.getUsedProductInfo(req);
    }


    /**
     * 获取销售出库导出运明细产品关联库存
     * @param id 出运明细主键id
     * @return 出运明细产品关联库存
     */
    @Override
    public List<ImportCarryProductOfOutStockRsp> getImportCarryDetailProductInfo(Integer id) {
        return carryDetailProductDao.getImportCarryDetailProductInfo(id);
    }
}
